package demoMod.stsconsole.commands;

import demoMod.stsconsole.ConsoleEntry;
import demoMod.stsconsole.enums.ErrType;
import demoMod.stsconsole.helpers.LocalizedStrings;

import java.util.List;
import java.util.Scanner;

public class Exit extends AbstractCommand {
    @Override
    public void execute(String[] args, Scanner sc) {
        List<String> commandStrings = LocalizedStrings.getCommandStrings("Exit");
        if (args.length > 0) {
            this.errMsg(ErrType.WRONG_ARGUMENT);
            return;
        }
        System.out.println(commandStrings.get(0));
        System.out.print(commandStrings.get(1));
        if (sc.nextLine().equals("y")) {
            ConsoleEntry.exit = true;
        }
    }

    @Override
    public boolean requiredPrompt(String currentPrompt) {
        return true;
    }
}
